<?php
include_once ("../Login/databaseconnection.php");
$q=$_GET["q"];
$hint="";
$name=explode(",",$q);
$nam=$name[0];
$tn=count($name);
for($i=1;$i<$tn;$i++)
{
if(empty($adr))
{
$adr=$name[$i];
}
else
{
$adr=$adr.",".$name[$i];
}
}
$results= mysql_query("SELECT * FROM school Where Name='$nam' AND Address='$adr'");
if($row = mysql_fetch_array($results))
{
 $School_Id=$row['School_Id'];
}
if($q!="")
{
$hint=$hint.'<select name="Lab_Id" id="select">';
$hint=$hint.'<option value="Select One">Select One</option>';
 $lab=mysql_query("SELECT DISTINCT(Lab_Id) FROM lab WHERE School_Id='$School_Id'");
  while($row=mysql_fetch_array($lab))
  {
	 $La_Id=$row['Lab_Id'];		 
	$hint=$hint.'<option value="'.$La_Id.'">'.$La_Id.'</option>';
  }
  $hint=$hint.'</select>';
}
if($hint=="")
{
$response="<input type='text' name='Lab_Id' id='Lab_Id' readonly='readonly'/>";
}
else
{
$response=$hint;
}
echo $response;
?>